//
//  UIButton+Extension.swift
//  MyWB
//
//  Created by 李成万 on 16/6/25.
//  Copyright © 2016年 李成万. All rights reserved.
//

import UIKit


extension UIButton{
    convenience init(imageName:String,backgroundImageName:String){
        self.init()
        if imageName == ""{
            setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
            setBackgroundImage(UIImage(named: "\(backgroundImageName)_highlighted"), forState: .Highlighted)
        }else if backgroundImageName == ""{
            setImage(UIImage(named: imageName), forState: UIControlState.Normal)
            setImage(UIImage(named: "\(imageName)_highlighted"), forState: .Highlighted)
        }else{
            setImage(UIImage(named: imageName), forState: UIControlState.Normal)
            setImage(UIImage(named: "\(imageName)_highlighted"), forState: .Highlighted)
            setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
            setBackgroundImage(UIImage(named: "\(backgroundImageName)_highlighted"), forState: .Highlighted)
        }
        
       
        
    }
}

